class DoublyLinkedList{
	public Node head;
	public Node tail;
	public Node current;
	public int count;
	double dr=0;
	String dt;
	Node node;
	public DoublyLinkedList(){
		head=null;
		tail=null;
		current=null;
		count=0;
		}
	 
	public Node insert(String m,Double n){
			Node newNode=new Node(m,n);
		
		if(head==null){
			head=newNode;
			newNode.place=m;
			newNode.val=n;
			} 
		
		else{
			tail.next=newNode;
			newNode.pre=tail;
			newNode.place=m;
			newNode.val=n;
			newNode.next=null;

			}

		tail=newNode;

		count++;
		return newNode;
		
        }
 public Double getValue(){
	current=head;
	while(current!=null){
	dr=current.getVal();
	
	}
	return dr;
	
 }
 public String getPlace(){
		current=head;
		
			dt=current.getPla();
			current=current.next;
		 
		
		return dt;
		 
	 }
public int getCount(){
	current=head;
	int cou=0;
	while(current!=null){
		cou++;
		current=current.next;
	}
	return cou;
}
 public Double Findbyplace(String s){
		current=head;
		boolean found=false;	
		while(!found&&current!=null)
		{
			if(current.place.equals(s))
			{
				found=true;
			}
		
			else
			{
				current=current.next;
			}
		
	    }
	    return current.val;
	
    }
 public String FindbyVal(Double s){
		current=head;
		boolean found=false;	
		while(!found&&current!=null)
		{
			if(current.val==s)
			{
				found=true;
			}
		
			else
			{
				current=current.next;
			}
		
	    }
	    return current.place;
	
 }
	
		public boolean exist(String e){
		current=head;
		boolean found=false;

		if(count==0){
			return found;
		}
	
		while(!found&&current!=null)
		{
			if(current.place.equals(e))
			{
				found=true;
			}
			else
			{
				current=current.next;
			}
		}
		return found;
	}
	
	public void display(){
		//System.out.println("test display");
		Node current=head;
		while(current!=null){
			current.displayNode();
			current=current.next;
		}
		System.out.println("");
	}
	
	}
